import { createRouter, createWebHashHistory } from "vue-router";
import VehicleDashboard from "@/pages/VehicleDashboard.vue";
import RequestPlayground from "@/pages/RequestPlayground.vue";

export const routes = [
  {
    path: "/",
    name: "VehicleDashboard",
    component: VehicleDashboard,
  },
  {
    path: "/requestPlayground",
    name: "RequestPlayground",
    component: RequestPlayground,
  },
];

function getRoutePath() {
  const obj = {};
  routes.forEach(item => {
    obj[item.name] = item.path;
  });
  return obj;
}

export const routeMap = getRoutePath();

export const router = createRouter({
  history: createWebHashHistory(), // use abstract mode because we don't need route paths and history record.
  routes,
});